#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAX_LEN 10

bool isPalindrome(int x){
    if (x < 0) {
        return false;
    }
    int num_splited[MAX_LEN] = {0};
    int num_splited_idx = MAX_LEN - 1;
    while (x > 0) {
        num_splited[num_splited_idx] = x % 10;
        x /= 10;
        num_splited_idx --;
    }

    int right = MAX_LEN - 1;
    int left = 0;
    for (int i = 0; i < MAX_LEN; i++) {
        if (num_splited[i] != 0) {
            left = i;
            break;
        }
    }

    while (left < right) {
        if (num_splited[left] != num_splited[right]) {
            return false;
        } else {
            left ++;
            right --;
        }
    }
    return true;
}

int main() {
    printf("%d\n", isPalindrome(101));
    printf("%d\n", isPalindrome(-101));
    printf("%d\n", isPalindrome(12021));
    printf("%d\n", isPalindrome(10));
}